package com.jixing.rengran.huaji.mvp.presenter;

import com.jixing.rengran.huaji.mvp.model.bean.HttpData;
import com.jixing.rengran.huaji.mvp.model.bean.UserBean;
import com.jixing.rengran.huaji.mvp.model.biz.AppModel;
import com.jixing.rengran.huaji.mvp.view.LoginView;

import io.reactivex.functions.Consumer;

/**
 * Created by l5544 on 2017/11/7.
 */

public class LoginPresenter extends BasePresenter<LoginView> {
    private AppModel appModel;

    public LoginPresenter() {
        appModel = new AppModel();
    }

    public void Login(String username,String password) {
        getView().showProgress();
        addDisposable(appModel.Login(username,password), new Consumer<HttpData<UserBean>>() {
            @Override
            public void accept(HttpData<UserBean> userBeanHttpData) throws Exception {
                getView().doLoginResult(userBeanHttpData);
            }

        });
    }
}
